home *** CD-ROM | disk | FTP | other *** search
/ Aminet 24 / Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso / Aminet / dev / c / AmiVoGL_MDEV.lha / src / rect.c < prev    next >
C/C++ Source or Header  |  1994-04-12  |  2KB  |  130 lines

  1. #include "vogl.h"
  2.  
  3. /*
  4.  * rect
  5.  *
  6.  * draw a rectangle given two opposite corners
  7.  *
  8.  */
  9. void rect(
  10.   Coord x1,
  11.   Coord y1,
  12.   Coord x2,
  13.   Coord y2)
  14. {
  15. if (!vdevice.initialised)
  16. verror("rect: vogl not initialised");
  17.  
  18. move2(x1, y1);
  19. draw2(x2, y1);
  20. draw2(x2, y2);
  21. draw2(x1, y2);
  22. draw2(x1, y1);
  23. }
  24.  
  25. /* ------------------------------------------------------------------------ */
  26.  
  27. /*
  28.  * recti
  29.  *
  30.  * draw a rectangle given two opposite corners (expressed as integers)
  31.  */
  32. void recti(
  33.   Icoord x1,
  34.   Icoord y1,
  35.   Icoord x2,
  36.   Icoord y2)
  37. {
  38. rect((Coord)x1, (Coord)y1, (Coord)x2, (Coord)y2);
  39. }
  40.  
  41. /* ------------------------------------------------------------------------ */
  42.  
  43. /*
  44.  * rects
  45.  *
  46.  * draw a rectangle given two opposite corners (expressed as short integers)
  47.  */
  48. void rects(
  49.   Scoord x1,
  50.   Scoord y1,
  51.   Scoord x2,
  52.   Scoord y2)
  53. {
  54. rect((Coord)x1, (Coord)y1, (Coord)x2, (Coord)y2);
  55. }
  56.  
  57. /* ------------------------------------------------------------------------ */
  58.  
  59. /*
  60.  * rectf
  61.  *
  62.  * draw a filled rectangle given two opposite corners
  63.  *
  64.  */
  65. void rectf(
  66.   Coord x1,
  67.   Coord y1,
  68.   Coord x2,
  69.   Coord y2)
  70. {
  71. Token    *tok;
  72.  
  73. if (!vdevice.initialised)
  74. verror("rect: vogl not initialised");
  75.  
  76. if (vdevice.inobject) {
  77.     tok = newtokens(5);
  78.     tok[0].i = RECTF;
  79.     tok[1].f = x1;
  80.     tok[2].f = y1;
  81.     tok[3].f = x2;
  82.     tok[4].f = y2;
  83.     return;
  84.     }
  85.  
  86. pmv2(x1, y1);
  87. pdr2(x2, y1);
  88. pdr2(x2, y2);
  89. pdr2(x1, y2);
  90. pdr2(x1, y1);
  91. pclos();
  92. }
  93.  
  94. /* ------------------------------------------------------------------------ */
  95.  
  96.  
  97. /*
  98.  * rectfi
  99.  *
  100.  * draw a filled rectangle given two opposite corners (expressed as integers)
  101.  */
  102. void rectfi(
  103.   Icoord x1,
  104.   Icoord y1,
  105.   Icoord x2,
  106.   Icoord y2)
  107. {
  108. rectf((Coord)x1, (Coord)y1, (Coord)x2, (Coord)y2);
  109. }
  110.  
  111. /* ------------------------------------------------------------------------ */
  112.  
  113. /*
  114.  * rectfs
  115.  *
  116.  * draw a filled rectangle given two opposite corners (expressed as short
  117.  * integers)
  118.  */
  119. void rectfs(
  120.   Scoord x1,
  121.   Scoord y1,
  122.   Scoord x2,
  123.   Scoord y2)
  124. {
  125. rectf((Coord)x1, (Coord)y1, (Coord)x2, (Coord)y2);
  126. }
  127.  
  128. /* ------------------------------------------------------------------------ */
  129.  
  130.